
#include "syscall.h"

int main(int argc, char** argv)
{

	char buf[256];
	int i, ret;

	for(i = 1; i <= 15; i++)
	{
    	sprintf(buf, "file%d.txt", i);
		ret = makeFile(buf);	
	}

	int pid = exec( "creat2.coff", 0, 0 );
	int* status;
	int childErr = join( pid, status );

 	printf( "Main Thread Exiting\n" );

	for(i = 1; i <= 15; i++)
	{
		sprintf(buf, "file%d.txt", i);
		ret = unlink(buf);
	}
	
	return ret;
}

int makeFile( char* filename ) {
   int ret = 0;
   int fd = creat( filename );
   if( fd != -1 ) {
      printf( "FileDescriptor for %s is %d\n", filename, fd );
   } else {
      printf( "error: could not create file: %s\n", filename );
      ret = -1;
   }
   return ret;
}
